<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>



</body>
<script src="../js/lib/jquery-1.9.0.js"></script>
<script>
    // 浏览器是否支持web worker标记
    var supportWorker = !!window.Worker;
    ; (function () {
        if (!supportWorker) {
            return
        }
        var worker = new Worker('../js/work.js');
        worker.postMessage({ method: 'test', data: ['a', [1], { a: 1 }] })
        worker.onmessage = function (event) {
            var data = event.data;
            if (data.method === 'error') {
                throw new Error(data.text)
            }
        }
    })();


</script>

</html>